#pragma once

/**
* @brief data type for pose
* @param x x-position
* @param y y-position
*/
struct htaPose {
	int x;		// x-position
	int y;		// y-position
};


/**
* @file this file contains the htaTracker class
* @class htaTracker
* @brief Class with the main functions of the Tracker
*/

class htaTracker
{
public:
	htaTracker();
	htaTracker(CvCapture* cap,int camIndex = 0);
	htaTracker(CvCapture* cap,const char* filename);
	~htaTracker();

	/**
	* @brief Initialize tracker with webcam support
	* @return true if succeed - otherwise false
	* @param camIndex Index of used webcam (default: 0)
	*/
	bool initTracker(CvCapture* cap,int camIndex = 0);

	/**
	* @brief Initialize tracker with AVI support
	* @return true if succeed - otherwise false
	* @param filename Path to the AVI-file
	*/
	bool initTracker(CvCapture* cap,const char* filename);

	/**
	* @brief Starts the tracking process
	*
	* This method starts the tracking process. The method gets the next image of the stream
	* and stores it in _frame. there is some image processing as well for the tracking.
	*/
	void trackObject();

	/**
	* @brief Get`s the position from the tracked object
	* @return The position of the tracked object
	*/
	htaPose getPosition(){ return _pose;};
	
	/**
	* @brief Get the current frame from video stream
	* @return Current video frame
	*/
	IplImage* getFrame(){return _frame;};

protected:

	/**
	* @brief Reset position
	*/
	void resetPose();

	// Member
private:
	htaPose _pose;				//< current object position
	CvBGStatModel* _bgModel;		//< BGModel
	CvCapture* _pCapture;		//< 
	IplImage* _frame;
	bool _useBGmodel;
	bool _updateBGmodel;
};
